package com.kaoqin.service.impl;

import java.util.List;

import org.quartz.Scheduler;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.kaoqin.code.common.metatype.Dto;
import com.kaoqin.code.quartz.util.ScheduleUtils;
import com.kaoqin.code.quartz.vo.QuartzVO;
import com.kaoqin.mapper.QuartzMapper;
import com.kaoqin.model.SignLogVO;
import com.kaoqin.service.QuartzService;
@Service
@Transactional
public class QuartzServiceImpl implements QuartzService {
	@Autowired
	private Scheduler schedulerBean;
	@Autowired
	private QuartzMapper mapper;
	@Override
	public int createJob(QuartzVO vo) {
		vo = new QuartzVO();
		vo.setJobCornDate("*/5 * * * * ?");
		vo.setJobName("JobName5");
		vo.setJobGroup("JobGroup");
		vo.setJobAliasName("JobAliasName");
		vo.setJobTrigger("JobTrigger");
		ScheduleUtils.createScheduleJob(schedulerBean, vo);
		
		
		
		
		return 0;
	}

	@Override
	public int updateJob(QuartzVO vo) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int delJob(Integer jobId) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public PageInfo<Dto> queryList(QuartzVO vo) {
		PageHelper.startPage(vo.getPageNum(), vo.getPageSize());
		List<Dto> list = mapper.findAll(vo);
		PageInfo<Dto> page = new PageInfo<Dto>(list);
		return page;
	}
}
